#include "signalhandler.h"
#include <cstdlib>

SignalHandler::SignalHandler()
{
}

SignalHandler::~SignalHandler()
{
}

void SignalHandler::install(unsigned int sig,Signal_Handler callback)
{
    struct sigaction sa;
    sa.sa_handler = callback;   
    sa.sa_flags   = 0;
    sigemptyset(&sa.sa_mask);
    sigaction(sig,  &sa, 0);
}


void SignalHandler::install(unsigned int sig,unsigned int flags, Signal_Sigaction callback)
{
    struct sigaction sa;
    sa.sa_sigaction = callback; 
    sa.sa_flags   = flags | SA_SIGINFO;
    sigemptyset(&sa.sa_mask);
    sigaction(sig,  &sa, 0);
}



